package com.songlanyun.modules.memberbill.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.songlanyun.common.enums.BillConstant;
import com.songlanyun.common.utils.PageUtils;
import com.songlanyun.modules.account.entity.UserIdentityAssetEntity;
import com.songlanyun.modules.memberbill.entity.*;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 充值卡账单
 *
 * @author Mark
 * @email sunlightcs@gmail.com
 * @date 2020-11-16 14:58:05
 */
public interface SaleRefillVoucherBillService extends IService<SaleRefillVoucherBillEntity> {

    PageUtils queryPage(Map<String, Object> params);

    /**
     * 余额收入接口
     *
     * @param userId     用户id
     * @param addMoney   收入的金额
     * @param outTradeNo 充值订单编号(收入)
     */
    void addBalance(Long userId, BigDecimal addMoney, String outTradeNo, BillConstant.InnerMode innerMode);


    void addBalance(Long userId, BigDecimal addMoney, String outTradeNo, BillConstant.InnerMode innerMode,String remark);

    /**
     * 余额支出接口
     *
     * @param userId     用户id
     * @param subMoney   支出的金额
     * @param outTradeNo 消费订单编号（支出）
     */
    void subBalance(Long userId, BigDecimal subMoney, String outTradeNo, BillConstant.OuterMode outerModel);

    void subBalance(Long userId, BigDecimal subMoney, String outTradeNo, BillConstant.OuterMode outerModel,String remark);

    /**
     * 生成收入账单
     *
     * @param userIdentity 会员资产
     * @param addMoney     收入金额
     * @param outTradeNo   充值订单编号
     * @param innerMode    收入行为（0充值，1退款余回退）
     */
    void saveIncomeBill(UserIdentityAssetEntity userIdentity, BigDecimal addMoney, String outTradeNo, BillConstant.InnerMode innerMode);
    void saveIncomeBill(UserIdentityAssetEntity userIdentity, BigDecimal addMoney, String outTradeNo, BillConstant.InnerMode innerMode,String remark);
    /**
     * 生成支出账单
     *
     * @param userIdentity 会员资产
     * @param subMoney     支出金额
     * @param outTradeNo   充值订单编号
     * @param outerModel   支出行为（0普通消费）
     */
    void saveExpenditureBill(UserIdentityAssetEntity userIdentity, BigDecimal subMoney, String outTradeNo, BillConstant.OuterMode outerModel);

    void saveExpenditureVoucherBill(UserIdentityAssetEntity userIdentity, BigDecimal subMoney, String outTradeNo, BillConstant.OuterMode outerModel);

    void saveExpenditureBill(UserIdentityAssetEntity userIdentity, BigDecimal subMoney, String outTradeNo, BillConstant.OuterMode outerModel,String remark);

    List<SaleRefillVoucherBillEntity> getUserBill(Long userId);

    PageUtils getUserBillPage(Long userId, Map<String, Object> params);

    void pointToBalance(Long userId, PointToBalanceDTO dto);

    PointToBalanceComputerVO pointGiveAwayComputer(Long userId, PointToBalanceDTO dto);

    void balanceGiveAway(Long userId, BalanceGiveAwayDTO dto);

    void adjustBalance(GiveBalanceDTO dto);

    void balanceToPoint(Long userId, BalanceToPointDTO dto);

    BalanceToPointComputerVO balanceToPointComputer(Long userId, BalanceToPointDTO dto);

    void adjustIntegral(GiveBalanceDTO dto);

    void subVoucher(Long userId, BigDecimal totalAmount, String code, BillConstant.OuterMode consume);
}

